package com.dingdang.sms.allinone.config

import com.dingdang.sms.allinone.sender.AllInOneSender
import com.dingdang.sms.allinone.sender.impl.AliyunSmsSender
import com.dingdang.sms.allinone.sender.impl.AliyunVmsSender
import com.dingdang.sms.allinone.sender.impl.JdCloudSender
import com.dingdang.sms.allinone.sender.impl.TencentCloudSender
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.beans.factory.annotation.Qualifier
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean
import org.springframework.context.annotation.Bean

open class AllInOneConfiguration {

    @Autowired
    lateinit var allInOneConfigurationProperties: AllInOneConfigurationProperties

    @Bean
    @Qualifier("aliyunSmsSender")
    @ConditionalOnMissingBean
    open fun aliyunSmsSender(): AllInOneSender {
        return AliyunSmsSender(allInOneConfigurationProperties)
    }

    @Bean
    @Qualifier("aliyunVmsSender")
    @ConditionalOnMissingBean
    open fun aliyunVmsSender(): AllInOneSender {
        return AliyunVmsSender(allInOneConfigurationProperties)
    }

    @Bean
    @Qualifier("jdCloudSender")
    @ConditionalOnMissingBean
    open fun jdCloudSender(): AllInOneSender {
        return JdCloudSender(allInOneConfigurationProperties)
    }

    @Bean
    @Qualifier("tencentCloudSender")
    @ConditionalOnMissingBean
    open fun tencentCloudSender(): AllInOneSender {
        return TencentCloudSender(allInOneConfigurationProperties)
    }


}